package com.test;

import java.util.Scanner;
import java.util.concurrent.CountDownLatch;

public class Reducer {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //输入减速机个数,不超过10个
        int n = sc.nextInt();
        final CountDownLatch latch = new CountDownLatch(n);
        for(int i = 1;i<=n;i++){
            new Thread(){public void run(){
                System.out.println("减速机"+Thread.currentThread().getName()+"自检开始");
                try{
                    Thread.sleep(3000); //自检中
                    System.out.println("减速机"+Thread.currentThread().getName()+"上传数据中");

                }catch (InterruptedException e){
                    e.printStackTrace();
                }
                System.out.println("减速机"+Thread.currentThread().getName()+"自检结束");
                latch.countDown();
            };}.start();
            int num = Thread.currentThread().getThreadGroup().activeCount();
        }
    }
}
